package com.xishu.dao.jpa;

import com.xishu.entity.shop.ShopFlag;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface ShopFlagDao extends JpaRepository<ShopFlag, Long>, JpaSpecificationExecutor<ShopFlag> {
    /**
     * 只保留一个月的数据
     *
     * @param endTime
     * @return
     */
    @Modifying
    @Transactional
    @Query("DELETE FROM shop_flag  m where m.createTime <= :endTime")
    public void keepOneMonthData(long endTime);
}
